Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
d3plus-network
Advanced tools
Javascript network visualizations built upon d3 modules.
If you use NPM, run npm install d3plus-network --save
. Otherwise, download the latest release. The released bundle supports AMD, CommonJS, and vanilla environments. You can also load directly from d3plus.org:
<script src="https://d3plus.org/js/d3plus-network.v0.6.full.min.js"></script>
Given an array of nodes and an array of links, d3plus-network creates a simple network visualization based on the supplied x and y coordinates.
var nodes = [
{id: "alpha", x: 1, y: 1},
{id: "beta", x: 2, y: 1},
{id: "gamma", x: 1, y: 2},
{id: "epsilon", x: 3, y: 2},
{id: "zeta", x: 2.5, y: 1.5},
{id: "theta", x: 2, y: 2}
];
The source
and target
keys in each link need to map to the nodes in one of three ways:
id
of the node.var links = [
{source: 0, target: 1},
{source: 0, target: 2},
{source: 3, target: 4},
{source: 3, target: 5},
{source: 5, target: 0}
];
Finally, these 2 variables simply need to be passed to a new Network class:
new d3plus.Network()
.links(links)
.nodes(nodes)
.render();
Click here to view this example live on the web.
This is a global class, and extends all of the methods and functionality of Viz
.
Viz
# new Network()
Creates a network visualization based on a defined set of nodes and edges. Click here for help getting started using the Network class.
If value is specified, sets the hover method to the specified function and returns the current class instance.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.links(links, [formatter]) <>
A predefined Array of edges that connect each object passed to the node method. The source
and target
keys in each link need to map to the nodes in one of three ways:
id
of the node.The value passed should either be an Array of data or a String representing a filepath or URL to be loaded. An optional formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final links Array.
This is a static method of Network
, and is chainable with other methods of this Class.
Param | Type | Description |
---|---|---|
links | Array | String | = [] |
[formatter] | function |
# Network.linkSize([value]) <>
Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.linkSizeMin([value]) <>
Defines the minimum pixel stroke width used in link sizing.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.linkSizeScale([value]) <>
Sets the specific type of continuous d3-scale used when calculating the pixel size of links in the network.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.nodeGroupBy([value]) <>
If value is specified, sets the node group accessor(s) to the specified string, function, or array of values and returns the current class instance. This method overrides the default .groupBy() function from being used with the data passed to .nodes(). If value is not specified, returns the current node group accessor.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.nodes(nodes, [formatter]) <>
The list of nodes to be used for drawing the network. The value passed should either be an Array of data or a String representing a filepath or URL to be loaded.
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final node Array.
This is a static method of Network
, and is chainable with other methods of this Class.
Param | Type | Description |
---|---|---|
nodes | Array | String | = [] |
[formatter] | function |
If value is specified, sets the size accessor to the specified function or data key and returns the current class instance. If value is not specified, returns the current size accessor.
This is a static method of Network
, and is chainable with other methods of this Class.
Defines the maximum pixel radius used in size scaling. By default, the maximum size is determined by half the distance of the two closest nodes.
This is a static method of Network
, and is chainable with other methods of this Class.
Defines the minimum pixel radius used in size scaling.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.sizeScale([value]) <>
Sets the specific type of continuous d3-scale used when calculating the pixel size of nodes in the network.
This is a static method of Network
, and is chainable with other methods of this Class.
If value is specified, sets the x accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If value is not specified, returns the current x accessor. By default, the x and y positions are determined dynamically based on default force layout properties.
This is a static method of Network
, and is chainable with other methods of this Class.
If value is specified, sets the y accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If value is not specified, returns the current y accessor. By default, the x and y positions are determined dynamically based on default force layout properties.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.linkSize([value]) <>
Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.linkSizeMin([value]) <>
Defines the minimum pixel stroke width used in link sizing.
This is a static method of Network
, and is chainable with other methods of this Class.
# Network.linkSizeScale([value]) <>
Sets the specific type of continuous d3-scale used when calculating the pixel size of links in the network.
This is a static method of Network
, and is chainable with other methods of this Class.
This is a global class, and extends all of the methods and functionality of Viz
.
# new Rings()
Creates a ring visualization based on a defined set of nodes and edges. Click here for help getting started using the Rings class.
Sets the center node to be the node with the given id.
This is a static method of Rings
, and is chainable with other methods of this Class.
If value is specified, sets the hover method to the specified function and returns the current class instance.
This is a static method of Rings
, and is chainable with other methods of this Class.
# Rings.links(links, [formatter]) <>
A predefined Array of edges that connect each object passed to the node method. The source
and target
keys in each link need to map to the nodes in one of three ways:
id
of the node.The value passed should either be an Array of data or a String representing a filepath or URL to be loaded. An optional formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final links Array.
This is a static method of Rings
, and is chainable with other methods of this Class.
Param | Type | Description |
---|---|---|
links | Array | String | = [] |
[formatter] | function |
# Rings.nodeGroupBy([value]) <>
If value is specified, sets the node group accessor(s) to the specified string, function, or array of values and returns the current class instance. This method overrides the default .groupBy() function from being used with the data passed to .nodes(). If value is not specified, returns the current node group accessor.
This is a static method of Rings
, and is chainable with other methods of this Class.
# Rings.nodes(nodes, [formatter]) <>
The list of nodes to be used for drawing the rings network. The value passed should either be an Array of data or a String representing a filepath or URL to be loaded.
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final node Array.
This is a static method of Rings
, and is chainable with other methods of this Class.
Param | Type | Description |
---|---|---|
nodes | Array | String | = [] |
[formatter] | function |
If value is specified, sets the size accessor to the specified function or data key and returns the current class instance. If value is not specified, returns the current size accessor.
This is a static method of Rings
, and is chainable with other methods of this Class.
If value is specified, sets the size scale maximum to the specified number and returns the current class instance. If value is not specified, returns the current size scale maximum. By default, the maximum size is determined by half the distance of the two closest nodes.
This is a static method of Rings
, and is chainable with other methods of this Class.
If value is specified, sets the size scale minimum to the specified number and returns the current class instance. If value is not specified, returns the current size scale minimum.
This is a static method of Rings
, and is chainable with other methods of this Class.
If value is specified, sets the size scale to the specified string and returns the current class instance. If value is not specified, returns the current size scale.
This is a static method of Rings
, and is chainable with other methods of this Class.
This is a global class, and extends all of the methods and functionality of Viz
.
# new Sankey()
Creates a sankey visualization based on a defined set of nodes and links. Click here for help getting started using the Sankey class.
If value is specified, sets the hover method to the specified function and returns the current class instance.
This is a static method of Sankey
, and is chainable with other methods of this Class.
A predefined Array of edges that connect each object passed to the node method. The source
and target
keys in each link need to map to the nodes in one of one way:
id
of the node.The value passed should be an Array of data. An optional formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final links Array.
This is a static method of Sankey
, and is chainable with other methods of this Class.
# Sankey.linksSource([value]) <>
The key inside of each link Object that references the source node.
This is a static method of Sankey
, and is chainable with other methods of this Class.
# Sankey.linksTarget([value]) <>
The key inside of each link Object that references the target node.
This is a static method of Sankey
, and is chainable with other methods of this Class.
# Sankey.nodeAlign([value]) <>
Sets the nodeAlign property of the sankey layout, which can either be "left", "right", "center", or "justify".
This is a static method of Sankey
, and is chainable with other methods of this Class.
If value is specified, sets the node id accessor(s) to the specified array of values and returns the current class instance. If value is not specified, returns the current node group accessor.
This is a static method of Sankey
, and is chainable with other methods of this Class.
The list of nodes to be used for drawing the network. The value passed must be an Array of data.
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final node Array.
This is a static method of Sankey
, and is chainable with other methods of this Class.
# Sankey.nodePadding([value]) <>
If value is specified, sets the padding of the node and returns the current class instance. If value is not specified, returns the current nodePadding. By default, the nodePadding size is 8.
This is a static method of Sankey
, and is chainable with other methods of this Class.
# Sankey.nodeWidth([value]) <>
If value is specified, sets the width of the node and returns the current class instance. If value is not specified, returns the current nodeWidth. By default, the nodeWidth size is 30.
This is a static method of Sankey
, and is chainable with other methods of this Class.
If value is specified, sets the width of the links and returns the current class instance. If value is not specified, returns the current value accessor.
This is a static method of Sankey
.
function value(d) {
return d.value;
}
FAQs
Javascript network visualizations built upon d3 modules.
The npm package d3plus-network receives a total of 346 weekly downloads. As such, d3plus-network popularity was classified as not popular.
We found that d3plus-network demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.